package com.dubbo.rpc.discovery;

import com.dubbo.rpc.discovery.strategy.AbstractLoadBalanceStrategy;
import com.dubbo.rpc.domain.ProviderInfo;
import com.dubbo.rpc.domain.ServiceDiscoveryInfo;

/**
 * @author liuxin
 * @date 2021/11/1 6:17 下午
 */
public class LoadbalanceContext {

    private AbstractLoadBalanceStrategy strategy;

    public LoadbalanceContext(AbstractLoadBalanceStrategy strategy) {
        this.strategy = strategy;
    }

    public ProviderInfo executeStrategy(ServiceDiscoveryInfo serviceDiscoveryInfo) {
        return strategy.select(serviceDiscoveryInfo);
    }

}
